import React from "react";
import './Todo.css';
import TodoHeader from "../TodoHeader/TodoHeader";
import TodoMain from "../TodoMain/TodoMain";
import TodoFooter from "../TodoFooter/TodoFooter";
import { useEffect } from "react";
import { useDispatch } from "react-redux";
import { asyncReqGetTodos } from "../../redux-n/slices/todoSlice";
export default function Todo() {
  //获取 dispatch 函数
  let dispatch = useDispatch();

  useEffect(() => {
    dispatch(asyncReqGetTodos());
  }, [])

  return (
    <div className="todo-container">
      <div className="todo-wrap">
        <TodoHeader  />
        <TodoMain  />
        <TodoFooter  />
      </div>
    </div>
  );
}
